const path = require('path');
const nodeExternals = require('webpack-node-externals');

module.exports = {
  mode: 'development',
  target: 'node',
  entry: path.resolve(__dirname, '../src/server/ssr.js'),
  output: {
    path: path.resolve(__dirname, '../build/node'),
    publicPath: '/build',
    filename: 'ssr.bundle.js',
    chunkFilename: '[name].[chunkhash:8].ssr.bundle.chunk.js',
    libraryExport: 'default',
    libraryTarget: 'commonjs2',
  },
  module: {
    rules: [
      { 
        test: /\.js$/,
        loader: 'babel-loader'
      }
    ]
  },
  externals: [nodeExternals()],
}
